from langchain_core.messages import SystemMessage, HumanMessage
from langchain_core.prompts import PromptTemplate

from my_llm import llm
# 导入输出解析器
from langchain_core.output_parsers import StrOutputParser

messages = [
    SystemMessage(content="Translate the following from English into Italian"),
    HumanMessage(content="hi!"),
]
prompt_template = PromptTemplate.from_template("帮我生成一个，简短的关于{topic}的报幕词")

# res = llm.invoke(messages)
#
parser = StrOutputParser()
# parser.invoke(res)

# 创建链式连接
chain = prompt_template | llm | parser
